<template>
	<view class="container">
		<view class="list">
			<view class="item bg-fff" v-for="(item,index) in orderList" :key="index">
				<view class="item-shop flex-space-between">
					<view class="flex-align-center">
						<!-- <view class="item-shop-name">{{item.supplier.name}}</view>
						<u-icon name="arrow-right" size="28rpx" color="#333333"></u-icon> -->
					</view>
					<view class="item-shop-status">
						<text v-if="item.is_order_refund == 1">已申请</text>
						<text v-if="item.is_order_refund == 2">已通过</text>
						<text v-if="item.is_order_refund == 3">拒绝</text>
					</view>
				</view>
				<view class="product-item flex" v-for="(it,idx) in item.product" :key="idx">
					<image class="product-item-image" :src="it.image.file_path"></image>
					<view class="product-item-con">
						<view class="product-item-name u-line-1">{{it.product_name}}</view>
						<view class="product-item-suk">{{it.product_attr}}</view>
						<view class="flex-space-between">
							<view class="product-item-price">￥{{it.product_price}}</view>
							<view class="product-item-num">x{{it.total_num}}</view>
						</view>
					</view>
				</view>
				<view class="item-total">合计：<text>￥{{item.pay_price}}</text></view>
				<view class="item-buttons flex-align-center">
					{{item.order_refund_content}}
				</view>
			</view>
		</view>
		
		<view v-if="orderList.length > 0">
			<b-u-loadmore :status="loadmoreStatus"></b-u-loadmore>
		</view>
		<view v-else style="padding-top: 100rpx;">
			<u-empty text="暂无数据" mode="data"></u-empty>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				orderList: [],
				pageForm: {
					page: 1,
					list_rows: 10,
				},
				loadmoreStatus: 'nomore',
			}
		},
		onLoad() {
			this.getHttp();
		},
		onReachBottom() {
			if(this.loadmoreStatus == 'nomore') {
				return;
			}
			this.pageForm.page++;
			this.getRefundList();
		},
		methods: {
			jump(url) {
				uni.navigateTo({
					url: url
				})
			},
			getRefundList() {
				this.loadmoreStatus = 'loading';
				uni.$u.api.getRefundList(this.pageForm).then(res => {
					this.orderList = this.orderList.concat(res.list.data);
					this.loadmoreStatus = 'loadmore';
					if(this.orderList.length  == res.list.total) {
						this.loadmoreStatus = 'nomore';
					}
				})
			},
			getHttp() {
				// uni.showLoading({
				// 	title: '加载中...',
				// 	mask: true
				// })
				
				this.getRefundList();

				// setTimeout(() => {
				// 	uni.hideLoading();
				// }, 800)
			},
		},
	}
</script>

<style lang="scss" scoped>
	.container {
		
		.tabs {
			position: fixed;
			top: 0;
			left: 0;
			z-index: 9;
			width: 100%;
		}
		
		.tabs-placeholder {
			height: 80rpx;
		}
		
		.list {
			padding: 30rpx;
			
			.item {
				padding: 26rpx;
				border-radius: 16rpx;
				margin-bottom: 24rpx;
				
				.item-shop-name {
					font-size: 28rpx;
					font-weight: bold;
					color: #111111;
				}
				
				.item-shop-status {
					font-size: 24rpx;
					color: $uni-color-theme;
				}
				
				.product-item {
					margin-top: 24rpx;
				
					.product-item-image {
						width: 128rpx;
						height: 128rpx;
					}
				
					.product-item-con {
						margin-left: 16rpx;
						flex: 1;
				
						.product-item-name {
							width: 460rpx;
							font-size: 28rpx;
							color: #111111;
						}
				
						.product-item-suk {
							width: 460rpx;
							font-size: 24rpx;
							color: #999999;
							margin-bottom: 10rpx;
						}
				
						.product-item-num {
							font-size: 24rpx;
							color: #999999;
						}
				
						.product-item-price {
							font-size: 28rpx;
							color: $uni-color-theme;
						}
					}
				}
				
				.item-total {
					margin-top: 34rpx;
					border-top: 1px solid rgba(225, 225, 225, 0.7);
					padding-top: 20rpx;
					text-align: right;
					font-size: 28rpx;
					color: #111111;
					
					text {
						color: $uni-color-theme;
						font-weight: bold;
					}
				}
				
				.item-buttons {
					margin-top: 20rpx;
					justify-content: flex-end;
				}
			}
		}
	}
</style>
